package com.bw.util;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/***************************
 FileAction:

 CreateTime:2022-08-25 10:09
 Author:Aaking-aline
 ****************************/
@Component
@Aspect
public class LogUtil {

	@Pointcut("execution(* com.bw.service..*.*(..))")
	public void printCut(){}

	@Around("printCut()")
	public Object printLog(ProceedingJoinPoint pjp){
		Object retObj = null;
		try{
			System.out.println("前置通知");
			Object[] args = pjp.getArgs();
			retObj = pjp.proceed(args);
			System.out.println("后置通知");
		}catch (Throwable throwable){
			System.out.println("异常通知");
		}finally {
			System.out.println("最终通知  return后");
		}
		return retObj;
	}

}
